cmake_minimum_required (VERSION 2.8)

project (klip)
include_directories( ./inc )

if (NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE Debug CACHE STRING
      "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
endif(NOT CMAKE_BUILD_TYPE)

if (NOT DEFINED OPENGL)
  SET(OPENGL YES CACHE STRING "Use OpenGL? (YES/NO) " FORCE)
endif(NOT DEFINED OPENGL)

if (NOT DEFINED DIRECTX)
  SET(DIRECTX NO CACHE STRING "Use Direct3D? (YES/NO) " FORCE)
endif(NOT DEFINED DIRECTX)

if (NOT DEFINED BOX2D)
  SET(DIRECTX YES CACHE STRING "Use Box2D? (YES/NO) " FORCE)
endif(NOT DEFINED BOX2D)

if (CMAKE_COMPILER_IS_GNUCXX)
	set (CMAKE_CXX_FLAGS "$(CMAKE_CXX_FLAGS) -std=c++0x")
endif (CMAKE_COMPILER_IS_GNUCXX)

if (CMAKE_BUILD_TYPE STREQUAL Debug)
	add_definitions(-D_DEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL Release)
	add_definitions(-D_RELEASE)
endif()

set(
	LIBRARY_OUTPUT_PATH
	"../${CMAKE_BUILD_TYPE}/"
)

set(
	SOURCE_FILES
	./src/kactor.cpp
	./src/kanimation.cpp
	./src/kbase.cpp
	./src/kbasicanimation.cpp
	./src/kbasiccontroller.cpp
	./src/kbasiclog.cpp
	./src/kbufferedstream.cpp
	./src/kcomponent.cpp
	./src/kcontroller.cpp
	./src/kdata.cpp
	./src/kencoding.cpp
	./src/kengine.cpp
	./src/kerror.cpp
	./src/kfont.cpp
	./src/kgraphics.cpp
	./src/kimage.cpp
	./src/kimagecache.cpp
	./src/kimagefile.cpp
	./src/kinifile.cpp
	./src/kinput.cpp
	./src/kline.cpp
	./src/klog.cpp
	./src/kmaterial.cpp
	./src/kmemorystream.cpp
	./src/kmesh2d.cpp
	./src/kperformance.cpp
	./src/kresources.cpp
	./src/kresourcesfiles.cpp
	./src/ksprite.cpp
	./src/kstate.cpp
	./src/kstdiostream.cpp
	./src/kstream.cpp
	./src/kstructdata.cpp
	./src/ktext.cpp
	./src/ktextreader.cpp
	./src/kview.cpp
	./src/kwatcher.cpp
)

if (WIN32)
	set (
		SOURCE_FILES
		${SOURCE_FILES}
		./src/ksystemwindows.cpp
	)
endif (WIN32)

if (UNIX)
	set (
		SOURCE_FILES
		${SOURCE_FILES}
		./src/ksystemlinux.cpp
	)
endif (UNIX)

if (DIRECTX)
	set (
		SOURCE_FILES
		${SOURCE_FILES}
		./src/kgraphicsdx.cpp
		./src/kimagedx.cpp
		./src/keffectcg.cpp
	)
endif (DIRECTX)

if (OPENGL)
	set (
		SOURCE_FILES
		${SOURCE_FILES}
		./src/kgraphicsgl.cpp
		./src/kimagegl.cpp
		./src/keffectcg.cpp
	)
endif (OPENGL)

if (BOX2D)
	set (
		SOURCE_FILES
		${SOURCE_FILES}
		./src/kbox2dcontroller.cpp
	)
endif (BOX2D)

add_library(
	klip
	${SOURCE_FILES}
)
